package com.tzbank.wisdom.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.tzbank.wisdom.service.LoanService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
/**
 * 贷款交易控制器
 * @author llz
 *
 */
@Api(tags = {"贷款操作控制"})
@RestController
@RequestMapping("loan")
@Slf4j
public class LoanController {
	@Resource
	private LoanService loanService;
	
	  @ResponseBody
	    @PostMapping(value = "/myloanqry")
	    @ApiOperation(value = "我的贷款信息查询", notes = "我的贷款信息查询接口")
		public Map<String,Object> getMyLoan(@RequestBody Map<String,Object> body){
	    	log.info(JSONObject.toJSONString(body));
			return loanService.getMyLoan(body);
		}
	
    @ResponseBody
    @PostMapping(value = "/scheduleinfos")
    @ApiOperation(value = "贷款申请信息查询", notes = "贷款申请信息查询接口")
	public Map<String,Object> getLoanScheduleInfos(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanScheduleInfos(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/quickloanlist")
    @ApiOperation(value = "快易贷列表查询", notes = "快易贷列表查询接口")
	public Map<String,Object> getQuickLoanList(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getQuickLoanList(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loandebitmsgqry")
    @ApiOperation(value = "贷款未还清记录查询", notes = "贷款未还清记录查询接口")
	public Map<String,Object> getLoanDebitMsgQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanDebitMsgQry(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loanrepayplandetailqry")
    @ApiOperation(value = "贷款还款计划列表查询", notes = "贷款还款计划列表查询接口")
	public Map<String,Object> getLoanRepayPlanDetailQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanRepayPlanDetailQry(body);
	}
    
    
    @ResponseBody
    @PostMapping(value = "/loanduedateqry")
    @ApiOperation(value = "贷款到期日查询 ", notes = "贷款到期日查询 接口")
	public Map<String,Object> getLoanDueDateQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanDueDateQry(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loancontractmsgqry")
    @ApiOperation(value = "贷款合同信息查询", notes = "贷款合同信息接口")
	public Map<String,Object> getLoanContractMsgQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanContractMsgQry(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loanInterestratecalculation")
    @ApiOperation(value = "贷款利率计算", notes = "贷款利率计算接口")
	public Map<String,Object> getLoanInterestRateCalculation(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanInterestRateCalculation(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loanrepaymentInterestqry")
    @ApiOperation(value = "小本贷款逾期还款利息查询", notes = "小本贷款逾期还款利息查询接口")
	public Map<String,Object> getLoanRepaymentInterestQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanRepaymentInterestQry(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loanInterestcalulation")
    @ApiOperation(value = "贷款利息计算", notes = "贷款利息计算接口")
	public Map<String,Object> getLoanInterestCalulation(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanInterestCalulation(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/loanInterestrateInfosqry")
    @ApiOperation(value = "贷款发放存贷积数比", notes = "贷款发放存贷积数比接口")
	public Map<String,Object> getLoanInterestRateInfosQry(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.getLoanInterestRateInfosQry(body);
	}
    
    
    @ResponseBody
    @PostMapping(value = "/loanapply")
    @ApiOperation(value = "贷款申请", notes = "贷款申请接口")
	public Map<String,Object> LoanApply(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.loanApply(body);
	}
    
    
    @ResponseBody
    @PostMapping(value = "/loanpayment")
    @ApiOperation(value = "贷款放款", notes = "贷款放款接口")
	public Map<String,Object> LoanPayment(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.loanPayment(body);
	}
    
  
    @ResponseBody
    @PostMapping(value = "/loanrepay")
    @ApiOperation(value = "贷款还款", notes = "贷款还款接口")
	public Map<String,Object> LoanRepay(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.loanRepay(body);
	}
    
    @ResponseBody
    @PostMapping(value = "/fastloanapply")
    @ApiOperation(value = "快易贷放款入账申请", notes = "快易贷放款入账申请接口")
	public Map<String,Object> FastLoanApply(@RequestBody Map<String,Object> body){
    	log.info(JSONObject.toJSONString(body));
		return loanService.fastLoanApply(body);
	}
    
    
    
	/**
	 * 获取验证码
	 * @param reqBody
	 * @return
	 */
	@ResponseBody
	@PostMapping(value = "/getCode")
	@ApiOperation(value = "获取验证码", notes = "贷款获取验证码接口")
	public Map<String, Object> getAuthCode(@RequestBody Map<String, String> reqBody) {
		return loanService.sendAuthCode(reqBody);
	}
	
	
	/**
	 * 贷款营销
	 * @param reqBody
	 * @return
	 */
	@ResponseBody
	@PostMapping(value = "/loanMarketing")
	@ApiOperation(value = "贷款营销", notes = "贷款营销接口")
	public Map<String, Object> loanMarketing(@RequestBody Map<String, String> reqBody) {
		return loanService.loanMarketing(reqBody);
	}
	
	
	
	
	
    
    
    
}
